package org.coderead.calculator;

import org.coderead.model.Performance;

public class ComedyCalculator extends AbstractPerformanceCalculator {

    @Override
    public int getAmount(Performance performance) {
        if (performance.getAudience() <= 20) {
            return 30000 + 300 * performance.getAudience();
        }
        return 40000 + 500 * (performance.getAudience() - 20) + 300 * performance.getAudience();
    }

    @Override
    public double getVolumeCredit(Performance performance) {
        return Math.max(performance.getAudience() - 30, 0) + Math.floor(performance.getAudience() / 5d);
    }
}